package com.gongren.project.job.oss;

import com.alibaba.dubbo.config.annotation.Reference;
import com.gongren.project.odd.job.rpc.api.oss.service.taskRpc.IBillDetailAmountStatisticsTaskRpcService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author houzhong
 * @Date 2017/9/1 13:02
 */
@Component("billDetailAmountStatisticsTask")
public class BillDetailAmountStatisticsTask {

    private static Logger LOGGER = LoggerFactory.getLogger(BillDetailAmountStatisticsTask.class);

    @Reference
    private IBillDetailAmountStatisticsTaskRpcService billDetailAmountStatisticsTaskRpcService;
    /**
     * 定时 每天早上 0:5分更新前一天交易数据数据
     */
    @Transactional
    //@Scheduled(cron = "0 5 0 ? * *")
    public void billDetailAmountStatisticsExcute(){

        LOGGER.info("BillDetailAmountStatisticsTask and billDetailAmountStatisticsExcute start");
        try {
            billDetailAmountStatisticsTaskRpcService.findAllBillDetailAmountStatisticsExcute();

            LOGGER.info("BillDetailAmountStatisticsTask and billDetailAmountStatisticsExcute end");
        }catch (Exception e) {
            LOGGER.error("BillDetailAmountStatisticsTask and billDetailAmountStatisticsExcute：", e);
        }
    }

}
